
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>类型系统 · ZanProxy</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="architecture.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../quick-start/">
            
                <a href="../../quick-start/">
            
                    
                    快速开始
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../quick-start/pre-install.html">
            
                <a href="../../quick-start/pre-install.html">
            
                    
                    前置条件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../quick-start/install.html">
            
                <a href="../../quick-start/install.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../quick-start/launch.html">
            
                <a href="../../quick-start/launch.html">
            
                    
                    启动
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../../quick-start/cert.html">
            
                <a href="../../quick-start/cert.html">
            
                    
                    证书安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../configure/">
            
                <a href="../../configure/">
            
                    
                    代理配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../configure/host.html">
            
                <a href="../../configure/host.html">
            
                    
                    Host管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../configure/rule.html">
            
                <a href="../../configure/rule.html">
            
                    
                    转发规则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../../configure/project.html">
            
                <a href="../../configure/project.html">
            
                    
                    工程路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../../configure/mock.html">
            
                <a href="../../configure/mock.html">
            
                    
                    mock数据
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../usage/">
            
                <a href="../../usage/">
            
                    
                    使用代理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../usage/chrome.html">
            
                <a href="../../usage/chrome.html">
            
                    
                    chrome代理配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../usage/mobile.html">
            
                <a href="../../usage/mobile.html">
            
                    
                    手机代理设置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../usage/enable.html">
            
                <a href="../../usage/enable.html">
            
                    
                    规则启用/禁用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../../usage/monitor.html">
            
                <a href="../../usage/monitor.html">
            
                    
                    请求监控
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../plugin/">
            
                <a href="../../plugin/">
            
                    
                    自定义插件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../../plugin/code.html">
            
                <a href="../../plugin/code.html">
            
                    
                    编写插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../plugin/usage.html">
            
                <a href="../../plugin/usage.html">
            
                    
                    使用插件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../">
            
                <a href="../">
            
                    
                    Mac 客户端
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../use.html">
            
                <a href="../use.html">
            
                    
                    使用方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="./">
            
                <a href="./">
            
                    
                    插件开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.1" data-path="directory.html">
            
                <a href="directory.html">
            
                    
                    目录结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.2" data-path="architecture.html">
            
                <a href="architecture.html">
            
                    
                    项目架构
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6.2.3" data-path="type-system.html">
            
                <a href="type-system.html">
            
                    
                    类型系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.4" >
            
                <span>
            
                    
                    插件开发指南
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.4.1" data-path="plugin-guide/start.html">
            
                <a href="plugin-guide/start.html">
            
                    
                    新建插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.4.2" data-path="plugin-guide/manager.html">
            
                <a href="plugin-guide/manager.html">
            
                    
                    Manager
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.4.3" data-path="plugin-guide/renderer.html">
            
                <a href="plugin-guide/renderer.html">
            
                    
                    Renderer
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.2.5" >
            
                <span>
            
                    
                    API参考
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.5.1" data-path="api/main.html">
            
                <a href="api/main.html">
            
                    
                    Main
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.5.2" data-path="api/renderer.html">
            
                <a href="api/renderer.html">
            
                    
                    Renderer
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../../cooperation/">
            
                <a href="../../cooperation/">
            
                    
                    团队协作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../cooperation/remoteRule.html">
            
                <a href="../../cooperation/remoteRule.html">
            
                    
                    远程规则
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >类型系统</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x7C7B;&#x578B;&#x7CFB;&#x7EDF;">&#x7C7B;&#x578B;&#x7CFB;&#x7EDF;</h2>
<p>zan-proxy-mac &#x58F0;&#x660E;&#x4E86;&#x4E00;&#x4E2A;&#x547D;&#x540D;&#x7A7A;&#x95F4; &#x2014;&#x2014; <code>ZanProxyMac</code>&#xFF0C;&#x9664;&#x4E86;&#x5168;&#x5C40;&#x5C5E;&#x6027;&#x548C;&#x4E00;&#x4E9B;&#x901A;&#x7528;&#x7C7B;&#x578B;&#x5916;&#xFF0C;&#x6240;&#x6709;&#x7684;&#x7C7B;&#x578B;&#x90FD;&#x88AB;&#x58F0;&#x660E;&#x5728;&#x8FD9;&#x4E2A;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x5185;&#x3002;</p>
<p>tsconfig.json &#x6307;&#x5B9A;&#x4E86;&#x7C7B;&#x578B;&#x6587;&#x4EF6;&#x7684;&#x76EE;&#x5F55;&#x4E3A;:</p>
<pre><code class="lang-json">{
  <span class="hljs-string">&quot;typeRoots&quot;</span>: [
    <span class="hljs-string">&quot;./src/gui/types&quot;</span>,
    <span class="hljs-string">&quot;./src/gui/main/managers&quot;</span>,
    <span class="hljs-string">&quot;./src/gui/plugins&quot;</span>
  ]
}
</code></pre>
<p>TypeScript &#x5728;&#x7F16;&#x8BD1;&#x65F6;&#xFF0C;&#x4F1A;&#x5C06;&#x5BF9;&#x5E94;&#x76EE;&#x5F55;&#x4E0B;&#x7684;&#x6240;&#x6709;&#x540C;&#x540D;&#x7C7B;&#x578B;&#x8FDB;&#x884C;&#x5408;&#x5E76;&#x3002;&#x56E0;&#x6B64;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5C06;&#x4E0D;&#x540C; Manager &#x76F8;&#x5173;&#x7C7B;&#x578B;&#x7684;&#x5B57;&#x6BB5;&#x5199;&#x5728;&#x4E0D;&#x540C;&#x7684;&#x6587;&#x4EF6;&#x4E2D;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x4F7F;&#x5F97;&#x7C7B;&#x578B;&#x7684;&#x6269;&#x5C55;&#x548C;&#x7BA1;&#x7406;&#x66F4;&#x52A0;&#x65B9;&#x4FBF;&#x3002;zan-proxy-mac &#x7684; Manager &#x4E8B;&#x4EF6;&#x540D;&#x79F0;&#x63D0;&#x793A;&#x529F;&#x80FD;&#x4E5F;&#x662F;&#x4F9D;&#x8D56;&#x8FD9;&#x4E2A;&#x529F;&#x80FD;&#x5B9E;&#x73B0;&#x7684;&#x3002;</p>
<h3 id="&#x7F16;&#x5199;&#x65B9;&#x5F0F;">&#x7F16;&#x5199;&#x65B9;&#x5F0F;</h3>
<p>&#x9700;&#x8981;&#x6269;&#x5C55;&#x6216;&#x65B0;&#x589E;&#x67D0;&#x4E2A;&#x7C7B;&#x578B;&#x65F6;&#xFF0C;&#x9700;&#x8981;&#x5728;&#x76F8;&#x5173;&#x7684;&#x76EE;&#x5F55;&#x4E0B;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; <code>*.d.ts</code>&#x6587;&#x4EF6;&#xFF0C;&#x8BE5;&#x6587;&#x4EF6;&#x9700;&#x8981;&#x58F0;&#x660E; namespace &#x4E3A; <code>ZanProxyMac</code>&#xFF0C;&#x540C;&#x65F6;&#x5728;&#x8BE5; namespace &#x5185;&#x7F16;&#x5199;&#x5BF9;&#x5E94;&#x7684;&#x7C7B;&#x578B;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">declare</span> <span class="hljs-keyword">namespace</span> ZanProxyMac {
  <span class="hljs-comment">// &#x4F60;&#x8981;&#x58F0;&#x660E;&#x6216;&#x6269;&#x5C55;&#x7684;&#x7C7B;&#x578B;</span>
  <span class="hljs-keyword">interface</span> INewType {}
}
</code></pre>
<p>&#x4E4B;&#x540E;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x5728;&#x5176;&#x4ED6;&#x6587;&#x4EF6;&#x4E2D;&#x7528; <code>ZanProxyMac.INewType</code> &#x7684;&#x65B9;&#x5F0F;&#x6765;&#x8BBF;&#x95EE;&#x4F60;&#x6240;&#x58F0;&#x660E;&#x7684;&#x7C7B;&#x578B;&#x6216;&#x6269;&#x5C55;&#x7684;&#x7C7B;&#x578B;&#x5B57;&#x6BB5;&#x4E86;&#x3002;</p>
<h3 id="&#x5E38;&#x7528;&#x7C7B;&#x578B;&#x4ECB;&#x7ECD;">&#x5E38;&#x7528;&#x7C7B;&#x578B;&#x4ECB;&#x7ECD;</h3>
<p>&#x4E0B;&#x9762;&#x4ECB;&#x7ECD;&#x5F00;&#x53D1;&#x65F6;&#x7ECF;&#x5E38;&#x4F1A;&#x7528;&#x5230;&#x6216;&#x9700;&#x8981;&#x6269;&#x5C55;&#x7684;&#x4E00;&#x4E9B;&#x7C7B;&#x578B;&#xFF08;&#x8FD9;&#x91CC;&#x6307;&#x7684;&#x6240;&#x6709;&#x7C7B;&#x578B;&#x90FD;&#x662F;&#x5728; ZanProxyMac &#x7684; namespace &#x4E2D;&#x7684;&#xFF09;&#xFF1A;</p>
<ul>
<li><p><code>interface IStorageStore</code>: Storage &#x7684;&#x5B58;&#x50A8;&#x503C;&#x7C7B;&#x578B;&#xFF0C;&#x76EE;&#x524D;&#x8BE5;&#x7C7B;&#x578B;&#x7684;&#x7C7B;&#x578B;&#x68C0;&#x67E5;&#x529F;&#x80FD;&#x4E0D;&#x662F;&#x5F88;&#x597D;&#xFF0C;&#x6CA1;&#x6709;&#x5BF9; set &#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x7684;&#x4F20;&#x53C2;&#x8FDB;&#x884C;&#x7C7B;&#x578B;&#x68C0;&#x67E5;&#x3002;</p>
</li>
<li><p><code>interface IDataEventMap</code>: &#x6709;&#x4F20;&#x503C;&#x7684;&#x4E8B;&#x4EF6;&#x7C7B;&#x578B;&#xFF0C;key &#x4E3A;&#x4E8B;&#x4EF6;&#x7684;&#x540D;&#x79F0;&#xFF0C;value &#x4E3A;&#x89E6;&#x53D1;&#x4E8B;&#x4EF6;&#x65F6;&#x4F20;&#x9012;&#x7684;&#x503C;&#x7684;&#x7C7B;&#x578B;&#xFF08;&#x4EC5;&#x6709;&#x4E00;&#x4E2A;&#xFF0C;&#x4E0D;&#x652F;&#x6301;&#x591A;&#x4E2A;&#x503C;&#x7684;&#x4F20;&#x9012;&#xFF09;&#x3002;</p>
</li>
<li><p><code>interface IEmptyEventMap</code>: &#x65E0;&#x4F20;&#x503C;&#x7684;&#x4E8B;&#x4EF6;&#x7C7B;&#x578B;&#xFF0C;key &#x4E3A;&#x4E8B;&#x4EF6;&#x7684;&#x540D;&#x79F0;&#xFF0C;value &#x56FA;&#x5B9A;&#x4E3A; <code>void</code>&#x3002;</p>
</li>
<li><p><code>interface IManagerGroup</code>: &#x6240;&#x6709; manager &#x7684;&#x96C6;&#x5408;&#xFF0C;&#x6269;&#x5C55;&#x8BE5;&#x7C7B;&#x578B;&#x540E;&#xFF0C;&#x53EF;&#x5728; application &#x7684; <code>emitOneManager</code> &#x548C; <code>emitOneManagerSerial</code> &#x65B9;&#x6CD5;&#x4E2D;&#x83B7;&#x53D6;&#x76F8;&#x5E94;&#x7684; manager &#x7684;&#x540D;&#x79F0;&#x3002;</p>
</li>
<li><p><code>interface IWorkspace</code>: &#x5DE5;&#x4F5C;&#x533A;&#x9884;&#x8BBE;&#x7684;&#x5BF9;&#x8C61;&#x7C7B;&#x578B;&#xFF0C;&#x82E5;&#x8981;&#x5728;&#x81EA;&#x5B9A;&#x4E49;&#x63D2;&#x4EF6;&#x4E2D;&#x6269;&#x5C55; workspace &#x5BF9;&#x8C61;&#xFF0C;&#x5219;&#x9700;&#x8981;&#x5148;&#x6269;&#x5C55;&#x8BE5;&#x5BF9;&#x8C61;&#x3002;</p>
</li>
<li><p><code>interface IExportOrImportData</code>: &#x5DE5;&#x4F5C;&#x533A;&#x5BFC;&#x51FA;&#x548C;&#x5BFC;&#x5165;&#x65F6;&#x7684;&#x6570;&#x636E;&#x5BF9;&#x8C61;&#x7C7B;&#x578B;&#xFF0C;&#x7528;&#x4E8E;&#x6269;&#x5C55;&#x5728;&#x5BFC;&#x51FA;&#x548C;&#x5BFC;&#x5165;&#x5DE5;&#x4F5C;&#x533A;&#x9884;&#x8BBE;&#x65F6;&#x5F97;&#x5230;&#x7684;&#x4E8B;&#x4EF6;&#x4F20;&#x9012;&#x6307;&#x7684;&#x5BF9;&#x8C61;</p>
</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="architecture.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 项目架构">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"类型系统","level":"1.6.2.3","depth":3,"next":{"title":"插件开发指南","level":"1.6.2.4","depth":3,"ref":"","articles":[{"title":"新建插件","level":"1.6.2.4.1","depth":4,"path":"gui/plugin/plugin-guide/start.md","ref":"gui/plugin/plugin-guide/start.md","articles":[]},{"title":"Manager","level":"1.6.2.4.2","depth":4,"path":"gui/plugin/plugin-guide/manager.md","ref":"gui/plugin/plugin-guide/manager.md","articles":[]},{"title":"Renderer","level":"1.6.2.4.3","depth":4,"path":"gui/plugin/plugin-guide/renderer.md","ref":"gui/plugin/plugin-guide/renderer.md","articles":[]}]},"previous":{"title":"项目架构","level":"1.6.2.2","depth":3,"path":"gui/plugin/architecture.md","ref":"gui/plugin/architecture.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":false,"twitter":false,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":[]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"ZanProxy","links":{"gitbook":false,"sharing":{"google":false,"facebook":false,"twitter":false,"all":false}},"gitbook":"*"},"file":{"path":"gui/plugin/type-system.md","mtime":"2019-03-08T06:06:12.816Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-03-08T06:08:21.743Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

